package statyczne_importy;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import static java.awt.Color.*;
import static java.lang.Math.max;
import static java.lang.Math.pow;
import static java.lang.System.out;
import static javax.swing.SwingUtilities.invokeLater;
import static java.lang.Thread.*;

/**
 * Autor: Daniel Michalski
 * Data: 12.07.13
 */

public class StaticImportFrame extends JFrame {
    public StaticImportFrame() {
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        Color[] colors = {red, blue, green};
        setLayout(new FlowLayout());
        for (Color color : colors) {
            JButton b = new JButton("Przycisk");
            b.setForeground(color);
            b.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    out.println("Akcja");
                }
            });
            add(b);
        }
        pack();
        setVisible(true);

        try {
            sleep(2000);
        } catch (Exception ignored) {}

        invokeLater(new Runnable() {
            @Override
            public void run() {
                getContentPane().setBackground(Color.yellow);
            }
        });

        double d = max(2.1, 2.3);
        out.println(d);
        d = pow(2, 7);
        out.println(d);
    }

    public static void main(String[] args) {
        new StaticImportFrame();
    }
}
